package com.gameone;

import android.graphics.Bitmap;
import android.graphics.Canvas;
 
public class Sprite1 {
       private int x = 40; 
       private int xSpeed = 15;
       private int y ; 
       private GameView gameView1;
       private Bitmap bmp1;
      
       public Sprite1(GameView gameView1, Bitmap bmp1) {
             this.gameView1=gameView1;
             this.bmp1=bmp1;
       }
 
       public Sprite1() {
		
	}

	private void update() {
             if (x > gameView1.getWidth() - bmp1.getWidth() - xSpeed) {
                    xSpeed = -5;
             }
             if (x + xSpeed< 0) {
                    xSpeed = 5;
             }
             x = x + xSpeed;
             y = gameView1.getHeight() - 20;
    	   /*if (x + xSpeed < 0)
    		   xSpeed = 110;
   		if (x + xSpeed > gameView.getWidth() - bmp.getWidth())
   			xSpeed = -110;
   		if (y + ySpeed < 0)
   			ySpeed = 110;
   		if (y + ySpeed > gameView.getHeight() - bmp.getHeight())
   			ySpeed = -110;
   		x = x + xSpeed;
   		y = y + ySpeed;*/
       }
      
       public void onDraw(Canvas canvas) {
             update();
             canvas.drawBitmap(bmp1, x , y , null);
       }
}
